<template>
  <ul class="catagtory">
      <li :class="{select:currentId === item.id}" v-for="item in typelist" :key="item.id" @click="currentFn(item.id)">{{item.name}}</li>
    </ul>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
  name: '',
  data () {
    return {

    }
  },
  created () {
    this.getTypelist()
  },
  computed: {
    ...mapState('type', ['typelist']),
    ...mapState('type', ['currentId'])
  },
  methods: {
    ...mapActions('type', ['getTypelist']),
    currentFn (id) {
      this.$store.commit('type/setCurrentId', id)
      this.$store.dispatch('list/getInfolist', id)
    }

  }

}
</script>
<style lang='less'  scoped>

</style>
